#ifndef _debug_h
#define _debug_h
#include <cpu.h>

///
//  Debugging stuffs from Napalm
// 

#define COM1	0x03F8  // IRQ 4
#define COM2	0x02F8  // IRQ 3
#define COM3	0x03E8  // IRQ 4
#define COM4	0x02E8  // IRQ 3

#ifdef DEBUG
#define dprint(...)  debug_printf (COM1, __VA_ARGS__)
#define dget(x,y)    debug_gets (COM1, x, y) 
#define debug_init() debug_setbaudrate(COM1, 57600)
#else
#define dprint(...)
#define debug_init()
#define dget(x,y)    panic("debugger not installed");
#endif

extern void debug_setbaudrate(unsigned short base, int rate);
extern void debug_put(unsigned short base, unsigned char c);
extern void debug_puts(unsigned short base, char * str);
extern int  debug_printf(unsigned short base, char * format, ...);
extern int  debug_get(unsigned short base);
extern int  debug_gets(unsigned short base, char * buf, int max);

#endif
